<extend name="Public:base"/>

<!--侧边导航-->
<block name="aside">
    <include file="Public:aside"/>
</block>

<block name="main">
<div class="">

    <form id="myform" class="form-horizontal" method='post' action="{:U('Menu/add')}">

        <div class="form-group">
            <label class="control-label col-md-2">上级:</label>
            <div class="col-md-6">
                <select name="parentid" class="form-control">
                    <option value="0">{:L('menu_top_menu')}</option>
                    {$select_categorys}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">名称:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="name" value="">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">应用:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="group" value="{$vo.group}" >
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">模块:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="model" value="">
            </div>
        </div>
        <div class="form-group">
            <lable class="control-label col-md-2">方法:</lable>
            <div class="col-md-6">
                <input type="text" class="form-control"  name="action" value="" > {:L('default')}:index
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">参数:</label>
            <div class="col-md-6">
                <input type="text" class="form-control"  name="data" value=""> {:L('examples')}:groupid=1&type=2
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">图标:</label>
            <div class="col-md-6">
                <!-- <i class="{$vo.icon}"></i> -->
                <input type="text" class="form-control" name="icon" >
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">备注:</label>
            <div class="col-md-6">
                <textarea class="form-control" name="remark" rows="5" cols="57">{$vo.remark}</textarea>
            </div>
        </div>
        <div class="form-group">
            <lable class="control-label col-md-2">状态:</lable>
            <div class="col-md-2">
                <select name="status" class="form-control">
                <option value="1">启用</option>
                <option value="0">禁用</option>
                </select>
            </div>
        </div>

        <div class="form-actions">
            <input type="submit" value="提交" class="btn btn-primary" />
            <a class="btn btn-primary" href="javascript:window.history.go(-1);">返回</a>
        </div>
    </form>
</div>
</block>

<block name="script">

    <script type="text/javascript">
        $(document).ready(function() {
            $('#myform').ajaxForm({
                success:  complete,  // post-submit callback
                dataType: 'json'
            });
        });

        function complete(data){
            if (data.status == 1) {

                layer.confirm(data.info, {
                    icon:1,
                    btn: ['继续添加','返回列表'] //按钮
                }, function(){
                    window.location.href = "{:U('Menu/add')}";
                    return false;
                }, function(){
                    window.location.href = "{$Think.cookie.__forward__}";
                    return true;
                });

            } else {
                layer.msg(data.info, {icon: 2});
            }

        }

    </script>
</block>